package com.qianli.cashmama.trade.client.trade.request;

import com.fqgj.common.api.ParamsObject;
import com.fqgj.exception.common.ApplicationException;
import org.apache.commons.lang.StringUtils;

/**
 * @program: cashmama-trade-center
 * @description 最新订单查询参数
 * @author: frank
 * @create: 2020-05-29 14:52
 **/
public class UserLatestTradeQueryRO extends ParamsObject {

    /**
     * 用户code
     */
    private String userCode;
    /**
     * 产品类目
     */
    private String productCategory;

    /**
     * 是否查询卡信息
     */
    private Boolean needCardInfo;

    public UserLatestTradeQueryRO(String userCode, String productCategory) {
        this.userCode = userCode;
        this.productCategory = productCategory;
    }

    public String getUserCode() {
        return userCode;
    }

    public UserLatestTradeQueryRO setUserCode(String userCode) {
        this.userCode = userCode;
        return this;
    }

    public String getProductCategory() {
        return productCategory;
    }

    public UserLatestTradeQueryRO setProductCategory(String productCategory) {
        this.productCategory = productCategory;
        return this;
    }

    public Boolean getNeedCardInfo() {
        return needCardInfo;
    }

    public UserLatestTradeQueryRO setNeedCardInfo(Boolean needCardInfo) {
        this.needCardInfo = needCardInfo;
        return this;
    }

    @Override
    public void validate() {
        if (StringUtils.isEmpty(userCode)) {
            throw new ApplicationException("Parameter error");
        }
        if (StringUtils.isEmpty(productCategory)) {
            productCategory = null;
        }
    }

}
